package com.lggry.array.operator;

public class OperatorDemo5 {
    public static void main(String[] args) {
        //目标：三元运算符
        receiveRedPacket(10,20);
        checkScore(59);
        getMax(50,60,70);
    }
    public static void receiveRedPacket(int a,int b) {
        int c = a > b ? a : b;
        System.out.println(c);
    }

    //判断成绩是否挂科
    public static void checkScore(int score){
        String result = score > 60? "及格":"挂科";
        System.out.println(result);
    }

    //需求：求三个整数的较大返回值
    public static void getMax(int a,int b,int c){
        //三元运算符的嵌套
        int max = a > b ? a > c ? a : c : b > c ? b : c;
        System.out.println(max);
    }
}
